<template>
  <div class="radarMes">
    <ul>
      <li v-for="(item,index) in $store.state.radar.radarCollection">
        radarId: {{item.asset.extras[0].Id}}
        <img class="view" src="~assets/images/eyeset.png" @click="showPosition(index)">
        <button class="delet" @click="delRadar(index)">删除</button>
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    name: '',
    props: {
      viewer: undefined
    },
    data() {
      return {

      }
    },
    components: {

    },
    methods: {
      // 点击跳转到雷达
      showPosition(index) {
        var radarPosition = this.$store.state.radar.radarCollection[index].asset.extras[0].Position;
        this.viewer.camera.setView({
          destination: {
            x: radarPosition.x - 5,
            y: radarPosition.y + 20,
            z: radarPosition.z
          },
          orientation: {
            heading: 0.37956290736570253,
            pitch: -0.8228171362975121,
            roll: 0.0017158205034117913
          }
        })
      },

      // 删除雷达
      delRadar(index) {
        this.$store.commit('delRadar', index)
      }
    }
  }
</script>

<style scpoed>
  @import '~assets/css/Cesium/radar/radarMessage.css';
</style>